/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package configuration;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Ashish
 *
 */
public class VisualRecognitionConfiguration {
	
	public String dataSetName = "dataSetName";
	public String dataURL = "dataURL";
	public String visualCategory = "visualCategory";
	public String descriptorURL = "descriptorURL";
	public String lshTableIndexURI = "lshTableIndexURI";
	public String trainimageSetURI = "trainimageSetURI";
	public String valimageSetURI = "valimageSetURI";
	public String fitnessProfileURL = "fitnessProfileURL";
	public String codebookCSV = "codebookCSV";
	public String imageSetURI = "imageSetURI";
	public String hashCodeFolderName = "hashCodeFolderName";
	public String maxHashCode = "maxHashCode";
	
	/**
	 * @param string
	 * @throws IOException 
	 */
	
	public VisualRecognitionConfiguration(String visrecogconfigFilename) throws IOException {
		File file = new File(visrecogconfigFilename);
		FileReader fr = new FileReader(file);
		BufferedReader br = new BufferedReader(fr);
		Map<String,String> vrcMap = new HashMap<String,String>();
		String line = null;
		while((line=br.readLine())!=null){
			if(!(line.startsWith("#", 0))){
				String[] inLine = line.split(":");
				String key = inLine[0];
				String value = inLine[1];
				vrcMap.put(key, value);
			}
		}
		br.close();
		fr.close();
		this.dataSetName = vrcMap.get(this.dataSetName);
		this.dataURL = vrcMap.get(this.dataURL);
		this.visualCategory = vrcMap.get(this.visualCategory);
		this.descriptorURL = vrcMap.get(this.descriptorURL);
		this.lshTableIndexURI = vrcMap.get(this.lshTableIndexURI);
		this.trainimageSetURI = vrcMap.get(this.trainimageSetURI);
		this.valimageSetURI = vrcMap.get(this.valimageSetURI);
		this.fitnessProfileURL = vrcMap.get(this.fitnessProfileURL);
		this.codebookCSV = vrcMap.get(this.codebookCSV);
		this.imageSetURI = vrcMap.get(this.imageSetURI);
		this.hashCodeFolderName = vrcMap.get(this.hashCodeFolderName);
		this.maxHashCode = vrcMap.get(this.maxHashCode);
	}
}
